import { reqCategoryList, reqBannerList, reqFloorList } from "@/api"
//home模块的小仓库
const actions = {
    async getCategoryList(context) {
        let result = await reqCategoryList();
        if (result.code == 200) {
            context.commit("CATEGORYLIST", result.data)
        }
    },
    async getBannerList(context) {
        let result = await reqBannerList();
        if (result.code == 200) {
            context.commit("BANNERLIST", result.data)
        }
    },
    async getFloorList(context) {
        let result = await reqFloorList();
        if (result.code == 200) {
            context.commit("FLOORLIST", result.data)
        }
    },
}
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList
    },
    BANNERLIST(state, bannerList) {
        state.bannerList = bannerList
    },
    FLOORLIST(state, floorList) {
        state.floorList = floorList
    }
}
const state = {
    categoryList: [],
    bannerList: [],
    floorList: []
}
const getters = {}

export default {
    namespaced: true,
    actions,
    mutations,
    state,
    getters
}